<?php

namespace App\Models;

use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Tymon\JWTAuth\Contracts\JWTSubject;

class User extends Authenticatable implements JWTSubject {
  use Notifiable;

  /**
   * The attributes that are mass assignable.
   *
   * @var array
   */
  protected $fillable = [
    'name',
    'email',
    'password',
  ];

  /**
   * The attributes that should be hidden for arrays.
   *
   * @var array
   */
  protected $hidden = [
    'password',
    'remember_token',
  ];


  /**
   * @return int
   */
  public function getJWTIdentifier() {
    return $this->getKey();
  }

  /**
   * @return array
   */
  public function getJWTCustomClaims() {
    return [];
  }

  public function avatar() {
    return $this->morphToMany( "App\Models\Attachment", 'attachmentable' );
  }
}
